<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class User_profiles_model extends CI_Model {

    function __construct() {
        parent::__construct();
    }

    function get_by_user($user_id) {
        return $this->db->get_where('user_profiles', array('id' => $user_id))->row();
    }

    function get_user_fullname($user_id=null) {
        if(!isset($user_id))
            $user_id = $this->tank_auth->get_user_id();

        $this->db->select('concat_ws(" ", up.firstname, up.lastname) as fullname', false)
                 ->from('user_profiles up')
                 ->where('up.id', $user_id);

        return $this->db->get()->row()->fullname;
    }
}